<?php

namespace App\Http\Controllers;

use GuzzleHttp\Client;

class OpenTestController extends Controller
{
    public function getIndex()
    {
        //        $appId = env('COMPONENT_APPID');
//        $appSecret = env('COMPONENT_APPSECRET');
//        $token = env('COMPONENT_TOKEN');
//        $aesKey = env('COMPONENT_AES_KEY');

        $openauthService = app('openauth');

        $authorizerAccessToken = $openauthService->refreshAuthorizerAccessToken('wx8512898f03f0c3a6', 'refreshtoken@@@z6bDHF5ao06Pc4bmC7-6viR7aFoa8Oxse9T9S_FPlnc');

        $url = 'https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token='.$authorizerAccessToken;

        $http = new Client();
        $res = $http->get($url);

        dump(json_decode(strval($res->getBody()), true));
    }
}
